package demo.controller;

import demo.config.NacosConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class NacosConfigController {

    @Value("${user.name}")
    private String name;

    @Value("${user.env}")
    private String env;

    @Autowired
    private NacosConfig nacosConfig;

    @RequestMapping("/getProperties")
    public String getNacosConfigProperties(){

        System.out.println("nacosConfig : " + nacosConfig);
        System.out.println("Config : " + name +"---" +env);

        return nacosConfig.toString() ;
    }

}
